package com.xtedu.examproject.service;

import com.xtedu.examproject.dao.base.QuestionTypeDao;
import com.xtedu.examproject.dao.impl.QuestionTypeDaoImpl;
import com.xtedu.examproject.entity.QuestionType;

import java.util.List;

public class QuestionTypeService {
    private QuestionTypeDao questionTypeDao;

    public QuestionTypeService() {
        questionTypeDao = new QuestionTypeDaoImpl();
    }

    public int insertQuestionType(QuestionType questionType) throws Exception {
        return questionTypeDao.insert(questionType);
    }

    public int deleteQuestionType(QuestionType questionType) throws Exception {
        return questionTypeDao.delete(questionType);
    }

    public int updateQuestionType(QuestionType questionType) throws Exception {
        return questionTypeDao.update(questionType);
    }

    public QuestionType findQuestionTypeById(int id) throws Exception {
        return questionTypeDao.findById(id);
    }

    public List<QuestionType> findAllQuestionType() throws Exception {
        return questionTypeDao.findAll();
    }
}
